import request from '@/utils/request'

export function xhrGetPageComponent(params = defaultParams) {
    return request({
        url: '/page/pageComponent',
        method: 'get',
        params
    })
}

export function xhrDeleteComponent(data) {
    return request({
        url: '/page/deleteComponent',
        method: 'post',
        data
    })
}

export function xhrAddRequest(data) {
    return request({
        url: '/page/addRequest',
        method: 'post',
        data
    })
}

export function xhrRequestList(params) {
    return request({
        url: '/page/request/list',
        method: 'get',
        params
    })
}

export function xhrSetComponent(data) {
    return request({
        url: '/page/installComponent',
        method: 'post',
        data
    })
}

export function xhrUserCanEdit() {
    return request({
        url: '/page/user/can/edit',
        method: 'get'
    })
}

export function autoRequest(url, method, params, data) {
    return request({
        url: url,
        method: method,
        params,
        data
    })
}
